package wiz.exch.util;

import wiz.exch.activity.R;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;


public class SharedSetting {
	
	private static SharedSetting sharedSetting = new SharedSetting();
	
	private SharedPreferences sharedPreferences;
	private Editor editor;
	private Context context;
	
	public void setSharedPreferences(Context context)
	{
		sharedPreferences = ((Activity)context).getPreferences(Activity.MODE_PRIVATE);
		editor = sharedPreferences.edit();
		this.context = context;
	}
	
	public static SharedSetting getInstance()
	{
		return sharedSetting;		
	}
	
	public String getValue(String key)
	{
		return sharedPreferences.getString(key, null);
	}
	public void put(String key, String value)
	{
		editor.putString(key, value);
	}
	public boolean commit()
	{
		return editor.commit();
	}
	public Context getContext()
	{
		return context;
	}
	
	public String getAppName()
	{
		return context.getResources().getString(R.string.app_name);
	}
}